const Sequelize = require('sequelize');
class SequelizeClient {
  //静态方法
  static getInstance() {
    if (!this.sequelize) {
      this.sequelize = new Sequelize({
        host: 'localhost',
        dialect: 'sqlite',
        pool: {
          max: 5,
          min: 0,
          acquire: 30000,
          idle: 10000,
        },
        define: {
          underscored: false,
          freezeTableName: false,
          charset: 'utf8',
          dialectOptions: {
            collate: 'utf8_general_ci',
          },
          timestamps: true,
        },
        storage: './casher.db',
      });
    }
    return this.sequelize;
  }
}
export default SequelizeClient;
